package com.eva.apidoc.knife4j;

import com.eva.apidoc.ApiDocProperties;
import com.eva.framework.config.AppProperties;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import jakarta.annotation.Resource;

/**
 * Swagger配置
 */
@Configuration
public class Knife4jConfig {

    @Resource
    private AppProperties appProperties;

    @Resource
    private ApiDocProperties apiDocProperties;

    @Bean
    public OpenAPI getApiInfo() {
        return new OpenAPI()
                .info(new Info()
                    .title(apiDocProperties.getTitle())
                    .description(apiDocProperties.getDescription())
                    .version(appProperties.getVersion())
                );
    }
}
